package com.gugee.ins.common.dal.mapper.statistics;

import com.gugee.common.mapper.GugeeMapper;
import com.gugee.ins.common.model.mysql.statistics.InsStBloggerFlBrand;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface InsStBloggerFlBrandMapper extends GugeeMapper<InsStBloggerFlBrand> {


    @Delete("delete from ins_st_blogger_fl_brand where uid = #{uid}")
    void deleteByUid(long uid);




    /**
     * 获取活跃粉丝品牌博主的排行
     */
    @Select("SELECT bf.f_uid brandUid,count(bf.uid) brandFollowerCount " +
            "FROM " +
            "ins_rel_blogger_active_follower baf " +
            "LEFT JOIN ins_rel_blogger_following bf ON baf.f_uid = bf.uid " +
            "WHERE " +
            "baf.uid = #{uid} " +
            "AND bf.f_type = 1 " +
            "GROUP BY " +
            "bf.f_uid ORDER BY brandFollowerCount DESC limit 0,#{limit}")
    List<InsStBloggerFlBrand> findActiveFollowerGroupByUid(long uid,int limit);
}